package actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.text.Document;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;

import app.MConstants;
public class ChooseFileAction extends Action {
	private Shell shell;
	private String filePath;
	private String modelType;
	private Object mainViewer;
	
	public String getModelType() {
		return modelType;
	}

	public ChooseFileAction(Shell shell, String modelType, Object mainViewer) {
		this.shell = shell;
		this.modelType = modelType;
		this.mainViewer = mainViewer;
		setId("modeling.actions.chooseModelAction");
		setText("Choose Model");
		setToolTipText("Choose Model");
//		setImageDescriptor();
	}

	@Override
	public void run() {
//		FileDialog dialog = new FileDialog(shell, SWT.OPEN);
//		dialog.setFilterPath("\\");
//		filePath =dialog.open();
//		//framework model - initial tree
//		if(MConstants.FRAMEWORK_MODEL.equals(modelType)) {
//			IDesignViewer idv = (IDesignViewer)this.mainViewer;
//			System.out.println("idvidvidvidv"+idv);
//			String content = "<xml>vxcv</xml>";
//			idv.setDocument(new Document(content));
//		}
	}

	public String getFilePath() {
		if(filePath!=null && !"".equals(filePath))
		return filePath;
		return "\\";
	}
	
}
